home *** CD-ROM | disk | FTP | other *** search
/ Delphi Programmer's Power Pack / Delphi Volume 1.iso / e_to_l / iacs / setup.arv / UNIT2.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1996-09-15  |  2.1 KB  |  76 lines

  1. unit Unit2;
  2. interface
  3. uses
  4.   SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  5.   Forms, Dialogs, StdCtrls, Buttons, DB, DBTables, Iaconn, Iabuttns,
  6.   DBCtrls, Iacsdb, Grids, DBGrids, ExtCtrls;
  7. {
  8. This quick demo shows how to use the TIADBComboBox.
  9.  
  10. This Demo uses the "DBDemos" alias to get to the Animals.db
  11.  
  12. The reason I created this component was becuase I didn't want to set up
  13. another Database file just to hold a few possible choices, but I didn't
  14. want to hard code the possible choices, for this field, either.
  15. I also wanted to be able to add to list at run time.
  16. }
  17. type
  18.   TForm2 = class(TForm)
  19.     IADBComboBox1: TIADBComboBox;
  20.     IASRBitBtn1: TIASRBitBtn;
  21.     IASRBitBtn2: TIASRBitBtn;
  22.     IASource1: TIASource;
  23.     CheckBox1: TCheckBox;
  24.     Table1: TTable;
  25.     DataSource1: TDataSource;
  26.     DBGrid1: TDBGrid;
  27.     DBNavigator1: TDBNavigator;
  28.     Button1: TButton;
  29.     procedure FormCreate(Sender: TObject);
  30.     procedure BitBtn1Click(Sender: TObject);
  31.     procedure CheckBox1Click(Sender: TObject);
  32.     procedure Button1Click(Sender: TObject);
  33.   private
  34.     { Private declarations }
  35.   public
  36.     { Public declarations }
  37.   end;
  38.  
  39. var
  40.   Form2: TForm2;
  41.  
  42. implementation
  43.  
  44. {$R *.DFM}
  45.  
  46. procedure TForm2.FormCreate(Sender: TObject);
  47. begin
  48.   {Point the filename porperty to the right directory,
  49.   If you do not specify a directory the INI file will be created in the
  50.   \Windows directory}
  51.   IASource1.FileName = ExtractFilePath(Application.ExeName) + IASource1.FileName;
  52.   {Get the INI values from the file, for all the connected components}
  53.   IASource1.UpdateControls;
  54.   {Set the KeepHistory property with the value of the checkbox. When Keep
  55.   history is true all the values entered into the combobox are stored in
  56.   the list.}
  57.   IADBComboBox1.KeepHistory:=CheckBox1.Checked;
  58. end;
  59.  
  60. procedure TForm2.BitBtn1Click(Sender: TObject);
  61. begin
  62.   Close;
  63. end;
  64.  
  65. procedure TForm2.CheckBox1Click(Sender: TObject);
  66. begin
  67.   IADBComboBox1.KeepHistory:=CheckBox1.Checked;
  68. end;
  69.  
  70. procedure TForm2.Button1Click(Sender: TObject);
  71. begin
  72.   IADBComboBox1.Items.Clear;  
  73. end;
  74.  
  75. end.
  76.